 |
Lexicographical order Totally Explained
|
|  |
|
NEW! |
All the latest news in the worlds of
computer gaming,
entertainment,
the environment,
finance,
health,
politics,
science,
stocks & shares,
technology
and much,
much,
more.
|
Everything about Lexicographic Order totally explainedIn mathematics, the lexicographic or lexicographical order, (also known as dictionary order, alphabetic order or lexicographic(al) product), is a natural order structure of the Cartesian product of two ordered sets.
Given two partially ordered sets A and B, the lexicographical order on the Cartesian product A × B is defined as » ( a, b) ≤ ( a′, b′) if and only if a ≤ a′ or ( a = a′ and b ≤ b′).
The result is a partial order. If A and B are totally ordered, then the result is a total order also.
More generally, one can define the lexicographic order on the Cartesian product of n ordered sets, on the Cartesian product of a countably infinite family of ordered sets, and on the union of such sets.
Motivation and uses
The name of the lexicographic order comes from its generalizing the order given to words in a dictionary: a sequence of letters (that is, a word)
» a1a2 ... ak
appears in a dictionary before a sequence
» b1b2 ... bk
if and only if the first ai which is different from bi comes before bi in the alphabet. That assumes both have the same length; what is usually done is to pad out the shorter word with symbols for 'blanks', and to consider that a blank is a new minimum ('bottom') element.
For the purpose of dictionaries, etc., one may assume that all words have the same length, by adding blank spaces at the end, and considering the blank space as a special character which comes before any other letter in the alphabet. This also allows ordering of phrases. See alphabetical order.
An important property of the lexicographical order is that it preserves well-orders, that is, if A and B are well-ordered sets, then the product set A × B with the lexicographical order is also well-ordered.
An important exploitation of lexicographical ordering is expressed in the ISO 8601 date formatting scheme, which expresses a date as YYYY-MM-DD. This date ordering lends itself to straightforward computerized sorting of dates such that the sorting algorithm doesn't need to treat the numeric parts of the date string any differently from a string of non-numeric characters, and the dates will be sorted into chronological order. Note, however, that for this to work, there must always be four digits for the year, two for the month, and two for the day, so for example single-digit days must be padded with a zero yielding '01', '02', ..., '09'.
Case of multiple products
Suppose »
|
|